package com.umeox.watch.moto.pedometer.base;

import android.content.Context;
import android.text.TextUtils;

import androidx.multidex.MultiDexApplication;

import com.tencent.mmkv.MMKV;
import com.umeox.moto.common.log.Logger;
import com.umeox.watch.moto.dataservice.DataProvider;
import com.umeox.watch.moto.pedometer.util.StepManager;

public class BaseApp extends MultiDexApplication {

    private static Context appContext;

    public static Context getAppContext() {
        return appContext;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        appContext = getApplicationContext();
        DataProvider.initialize(this);
        BaseDatabase.setup(this);
        MMKV.initialize(this);
        String nodePath = StepManager.getInstance().getCurrentStepNodePath();
        Logger.e("nodePath=" + nodePath);
        String currentStepCountNodePath;
        if (!TextUtils.isEmpty(nodePath)) {
            currentStepCountNodePath = nodePath.replace("name", "step_counts");
            Logger.e("currentStepCountNodePath=" + currentStepCountNodePath);
            StepManager.getInstance().setStepCountsNode(currentStepCountNodePath);
        }
    }
}
